/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.techopropio.bfh.service;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author fskcoder
 */
public class ConexionMySql {

    private Connection connection;

    public void init() throws ClassNotFoundException, SQLException {
        String user = "root";
        String pass = "fskcoder";
        String db = "voto";
        String url = "jdbc:mysql://localhost/" + db;
        String driver = "com.mysql.jdbc.Driver";
        Class.forName(driver);
        connection = null;
        connection = DriverManager.getConnection(url, user, pass);
    }

    public void init(String driver, String url, String user, String pass) throws SQLException, ClassNotFoundException {
        Class.forName(driver);
        connection = null;
        connection = DriverManager.getConnection(url, user, pass);
    }

    public Connection getConnection() {
        return connection;
    }
}
